package com.zhang.queue;

/**
 * @author zhang
 * @time 2022/03/07 21:35:52
 */
public class LinkedListQeue {
    private class Node {
        private int value;
        private Node next;

        public Node(int value) {
            this.value = value;
        }
    }

    private Node head;
    private Node tail;
    private int count;

    public void enqueue(int value) {
        Node node = new Node(value);

        if (isEmpty()) {
            head = tail = node;
        }
        tail.next = node;
        tail  = node;
        count++;
    }

    // O(1)
    public int size() {
        return count;
    }

    // O(1)
    public boolean isEmpty() {
        return head == null;
    }


}
